package com.entity;

import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

/**
 * Production entity. @author MyEclipse Persistence Tools
 */

public class Production implements java.io.Serializable {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Integer id;
	private Admin admin;
	private ProductCategory productCategory;
	private String productName;
	private String productDescription;
	private Date insertTime;
	private Integer productViews;
	private Boolean isHot;
	private Boolean isTop;
	private Boolean isDeleted;
	private Set<ProductImage> productImages = new HashSet<ProductImage>(0);
	
	public final static String IS_HOT = "isHot";
	public final static String IS_TOP = "isTop";
	public final static String INSERT_TIME = "insertTime";

	// Constructors

	/** default constructor */
	public Production() {
	}

	/** full constructor */
	public Production(Admin admin, ProductCategory productCategory,
			String productName, String productDescription, Date insertTime,
			Integer productViews, boolean isHot, boolean isTop,
			boolean isDeleted, Set<ProductImage> productImages) {
		this.admin = admin;
		this.productCategory = productCategory;
		this.productName = productName;
		this.productDescription = productDescription;
		this.insertTime = insertTime;
		this.productViews = productViews;
		this.isHot = isHot;
		this.isTop = isTop;
		this.isDeleted = isDeleted;
		this.productImages = productImages;
	}

	// Property accessors

	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Admin getAdmin() {
		return this.admin;
	}

	public void setAdmin(Admin admin) {
		this.admin = admin;
	}

	public ProductCategory getProductCategory() {
		return this.productCategory;
	}

	public void setProductCategory(ProductCategory productCategory) {
		this.productCategory = productCategory;
	}

	public String getProductName() {
		return this.productName;
	}

	public void setProductName(String productName) {
		this.productName = productName;
	}

	public String getProductDescription() {
		return this.productDescription;
	}

	public void setProductDescription(String productDescription) {
		this.productDescription = productDescription;
	}

	public Date getInsertTime() {
		return this.insertTime;
	}

	public void setInsertTime(Date insertTime) {
		this.insertTime = insertTime;
	}

	public Integer getProductViews() {
		return this.productViews;
	}

	public void setProductViews(Integer productViews) {
		this.productViews = productViews;
	}

	public Boolean getIsHot() {
		return this.isHot;
	}

	public void setIsHot(Boolean isHot) {
		this.isHot = isHot;
	}

	public Boolean getIsTop() {
		return this.isTop;
	}

	public void setIsTop(Boolean isTop) {
		this.isTop = isTop;
	}

	public Boolean getIsDeleted() {
		return this.isDeleted;
	}

	public void setIsDeleted(Boolean isDeleted) {
		this.isDeleted = isDeleted;
	}

	public Set<ProductImage> getProductImages() {
		return this.productImages;
	}

	public void setProductImages(Set<ProductImage> productImages) {
		this.productImages = productImages;
	}
	
	public String getOneImage(){
		Iterator<ProductImage> it = this.productImages.iterator();
		if(it.hasNext()){
			return it.next().getProductImage();
		}
		return "";
	}

}